<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/jsp/common/common.jsp"%>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<title>列表</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>${description}<span class="c-gray en">&gt;</span> 列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<form action="queryList" id="form_id">
		<div class="text-c">
			主键ID：
			<input type="text" class="input-text" style="width:20%" placeholder="主键ID" id="id" name="id" value="${r"${"}requestModel.id${r"}"}">

			<button type="button" class="btn btn-success radius" id="" name="" onclick="query()"><i class="Hui-iconfont">&#xe665;</i> 查询</button>
		</div>
		<div class="cl pd-5 bg-1 bk-gray mt-20">
			<span class="l">
				<a href="javascript:;" onclick="layer_show('新增','goAdd','800','510')" class="btn btn-primary radius">
					<i class="Hui-iconfont">&#xe600;</i>新增</a>
			</span>
		</div>
		<div class="mt-20">
			<table class="table table-border table-bordered table-hover table-bg table-sort" id="tab" name="tab">
				<thead id="table_thead">
				<tr class="text-c">
					<th width="80">序号</th>
				<#list modelColumns as item>
                    <th width="100"><span class="tbicon sortdw"  data-column="${item.attrName}">${attrRemarks[item_index]}</span></th>
				</#list>
					<th>操作</th>
				</tr>
				</thead>
				<tbody>
				<c:forEach items="${r"${"}list${r"}"}" var="item" varStatus="itemStatus">
					<tr class="text-c">
						<td>${r"${"}itemStatus.index+1${r"}"}</td>
						<#list modelColumns as item>
						<#if item.attrType == "Date">
                        <td><fmt:formatDate value="${r"${"}item.${item.attrName}${r"}"}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
						<#else>
						<td>${r"${"}item.${item.attrName}${r"}"}</td>
						</#if>
						</#list>
						<td class="td-manage">
							<a href="javascript:void(0)" onclick="layer_show('修改','goEdit?id=${r"${"}item.id${r"}"}','800','510')">修改</a>
							<a href="javascript:void(0)" onclick="del(${r"${"}item.id${r"}"})">删除</a>
						</td>
					</tr>
				</c:forEach>
				</tbody>
			</table>
		</div>
		<pager:pagerTag pageTotal="${r"${"}page.pages${r"}"}" sortOrder="${r"${"}page.sortOrder${r"}"}" currentPage="${r"${"}page.current${r"}"}" sortColumn="${r"${"}page.sortColumn${r"}"}" formId="form_id"/>
	</form>
</div>
</body>
<script type="text/javascript">
	function refresh(){
		$("#form_id").submit();
	}

	function del(id){
		layer.confirm('确认要删除吗？',function(index){
			layer.close(index);
			//此处为遮罩层
			var load_idx = layer.load(1, {shade: [0.1,'#fff']});
			$.post("delete",{id:id},function(result){
				layer.close(load_idx);
				if(result.success){
					layer.msg('已删除!',{icon:1,time:1000},function(){
						refresh();
					});
				}else{
					layer.msg(result.msg,{icon:5});
				}
			});
		});
	}

	function query(){
        $("#sortColumn").remove();
        $("#current").remove();
        $("#form_id").submit();
	}
</script>
</html>